{extend name="public/base" /}
{block name="body"}
<body class="hold-transition skin-purple sidebar-mini">

<!-- 新增模态框 -->
<div class="modal fade" id="addModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
    <div class="modal-dialog" style="top:10%;" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                    <span aria-hidden="true">×</span>
                </button>
                <h4 class="modal-title" id="myModalLabel">新增产品</h4>
            </div>
            <form id="addForm" method="post">
                <div class="modal-body" style="height: 100%;text-align: center;">
                    <div class="form-group" style=" height: 36px;">
                        <label for="firstname" style="height:34px; padding-top:1.2%;" class="col-sm-3 control-label">产品名称</label>
                        <div class="col-sm-9">
                            <input id="add_gName" name="gName" class="form-control" maxlength="20" autoComplete="off">
                        </div>
                    </div>
                    <div class="form-group" style=" height: 36px;">
                        <label for="firstname" style="height:34px; padding-top:1.2%;" class="col-sm-3 control-label">产品介绍</label>
                        <div class="col-sm-9">
                            <input id="add_gIntroduce" name="gIntroduce" class="form-control" maxlength="50" autoComplete="off">
                        </div>
                    </div>
                    <div class="form-group" style=" height: 36px;">
                        <label for="firstname" style="height:34px; padding-top:1.2%;" class="col-sm-3 control-label">证书编号</label>
                        <div class="col-sm-9">
                            <input id="add_gAUTCode" name="gAUTCode" class="form-control" maxlength="20" autoComplete="off">
                        </div>
                    </div>
                    <div class="form-group" style=" height: 36px;">
                        <label for="firstname" style="height:34px; padding-top:1.2%;" class="col-sm-3 control-label">产品类别</label>
                        <div class="col-sm-9">
                            <input id="add_gClass" name="gClass" class="form-control" maxlength="10" autoComplete="off">
                        </div>
                    </div>
                    <div class="form-group" style=" height: 36px;">
                        <label for="firstname" style="height:34px; padding-top:1.2%;" class="col-sm-3 control-label">产地环境</label>
                        <div class="col-sm-9">
                            <input id="add_gENV" name="gENV" class="form-control" maxlength="50" autoComplete="off">
                        </div>
                    </div>
                    <div class="form-group" style=" height: 36px;">
                        <label for="firstname" style="height:34px; padding-top:1.2%;" class="col-sm-3 control-label">产品图片</label>
                        <div class="col-sm-9">
                            <input id="add_gImg" name="gImg" type="file">
                        </div>
                    </div>
                </div>
                <div class="modal-footer">
                    <button type="submit" class="btn btn-primary">保存</button>
                    <button type="button" class="btn btn-default" data-dismiss="modal" onclick="reloadPage()">关闭</button>
                </div>
            </form>
        </div>
    </div>
</div>
<!-- /新增模态框 -->

<!-- 更改图片模态框 -->
<div class="modal fade" id="imgModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
    <div class="modal-dialog" style="top:20%;" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                    <span aria-hidden="true">×</span>
                </button>
                <h4 class="modal-title" id="myModalLabel">更改图片</h4>
            </div>
            <form id="imgForm" enctype="multipart/form-data" method="post">
                <div class="modal-body" style="height: 100%;text-align: center;">
                    <div class="form-group" style=" height: 36px;">
                        <div>
                            <input id="img_file" type="file" name="image">
                            <input type="hidden" name="gID" id="img_gID">
                        </div>
                    </div>
                </div>
                <div class="modal-footer">
                    <button type="submit" onclick="btnImg()" class="btn btn-primary">保存</button>
                    <button type="button" class="btn btn-default" data-dismiss="modal" onclick="reloadPage()">关闭</button>
                </div>
            </form>
        </div>
    </div>
</div>
<!-- /更改图片模态框 -->

<!-- 显示图片模态框 -->
<div class="modal fade" id="bigImgModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
    <div class="modal-dialog" style="top:20%;left: 8%;" role="document">
        <div class="modal-content" style="width: 350px;padding: 0 10px;">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                    <span aria-hidden="true">×</span>
                </button>
            </div>
                <div class="modal-body" style="height: 100%;width: 100%;text-align: center;">
                    <div style="width: 300px;height: 300px;">
                        <img id="bigImg" src="" alt="暂无" style="width: 100%;height: 100%;">
                    </div>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                </div>
        </div>
    </div>
</div>
<!-- /显示图片模态框 -->

<!-- 详情模态框 -->
<div class="modal fade" id="detailModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
    <div class="modal-dialog" style="top:5%;" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                    <span aria-hidden="true">×</span>
                </button>
                <h4 class="modal-title" id="myModalLabel">产品详情</h4>
            </div>
            <form id="detailForm" method="post">
                <div class="modal-body" style="height: 100%;text-align: center;">
                    <div class="form-group" style=" height: 100%;">
                        <div>
                            <img src="" style="width: 170px;height: 120px;" id="detail_gImg" alt="暂无图片">
                        </div>
                    </div>
                    <div class="form-group" style="text-align: center; height: 36px;">
                        <label for="firstname" style="height:34px; padding-top:1.2%;" class="col-sm-3 control-label">产品编号</label>
                        <div class="col-sm-9">
                            <input id="detail_gID" class="form-control" readonly="readonly">
                        </div>
                    </div>
                    <div class="form-group" style=" height: 36px;">
                        <label for="firstname" style="height:34px; padding-top:1.2%;" class="col-sm-3 control-label">产品名称</label>
                        <div class="col-sm-9">
                            <input id="detail_gName" name="gName" class="form-control" readonly="readonly">
                        </div>
                    </div>
                    <div class="form-group" style=" height: 36px;">
                        <label for="firstname" style="height:34px; padding-top:1.2%;" class="col-sm-3 control-label">产品介绍</label>
                        <div class="col-sm-9">
                            <input id="detail_gIntroduce" name="gIntroduce" class="form-control" readonly="readonly">
                        </div>
                    </div>
                    <div class="form-group" style=" height: 36px;">
                        <label for="firstname" style="height:34px; padding-top:1.2%;" class="col-sm-3 control-label">证书编号</label>
                        <div class="col-sm-9">
                            <input id="detail_gAUTCode" name="gAUTCode" class="form-control" readonly="readonly">
                        </div>
                    </div>
                    <div class="form-group" style=" height: 36px;">
                        <label for="firstname" style="height:34px; padding-top:1.2%;" class="col-sm-3 control-label">产品类别</label>
                        <div class="col-sm-9">
                            <input id="detail_gClass" name="gClass" class="form-control" readonly="readonly">
                        </div>
                    </div>
                    <div class="form-group" style=" height: 36px;">
                        <label for="firstname" style="height:34px; padding-top:1.2%;" class="col-sm-3 control-label">产地环境</label>
                        <div class="col-sm-9">
                            <input id="detail_gENV" name="gENV" class="form-control" readonly="readonly">
                        </div>
                    </div>
                    <div class="form-group" style=" height: 36px;">
                        <label for="firstname" style="height:34px; padding-top:1.2%;" class="col-sm-3 control-label">产品销售码</label>
                        <div class="col-sm-9">
                            <input id="detail_gSellCode" name="gSellCode" class="form-control" readonly="readonly">
                        </div>
                    </div>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                </div>
            </form>
        </div>
    </div>
</div>
<!-- /详情模态框 -->

<!-- 修改模态框 -->
<div class="modal fade" id="editModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
    <div class="modal-dialog" style="top:10%;" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                    <span aria-hidden="true">×</span>
                </button>
                <h4 class="modal-title" id="myModalLabel">修改产品信息</h4>
            </div>
            <form id="editForm" method="post">
            <div class="modal-body" style="height: 100%;text-align: center;">
                    <div class="form-group" style="text-align: center; height: 36px;">
                        <label for="firstname" style="height:34px; padding-top:1.2%;" class="col-sm-3 control-label">产品编号</label>
                        <div class="col-sm-9">
                            <input id="edit_gID" class="form-control" disabled>
                            <input id="edit_gID_hidden" type="hidden" name="gID" autoComplete="off">
                        </div>
                    </div>
                    <div class="form-group" style=" height: 36px;">
                        <label for="firstname" style="height:34px; padding-top:1.2%;" class="col-sm-3 control-label">产品名称</label>
                        <div class="col-sm-9">
                            <input id="edit_gName" name="gName" class="form-control" maxlength="20" autoComplete="off">
                        </div>
                    </div>
                    <div class="form-group" style=" height: 36px;">
                        <label for="firstname" style="height:34px; padding-top:1.2%;" class="col-sm-3 control-label">产品介绍</label>
                        <div class="col-sm-9">
                            <input id="edit_gIntroduce" name="gIntroduce" class="form-control" maxlength="50" autoComplete="off">
                        </div>
                    </div>
                    <div class="form-group" style=" height: 36px;">
                        <label for="firstname" style="height:34px; padding-top:1.2%;" class="col-sm-3 control-label">证书编号</label>
                        <div class="col-sm-9">
                            <input id="edit_gAUTCode" name="gAUTCode" class="form-control" maxlength="20" autoComplete="off">
                        </div>
                    </div>
                    <div class="form-group" style=" height: 36px;">
                        <label for="firstname" style="height:34px; padding-top:1.2%;" class="col-sm-3 control-label">产品类别</label>
                        <div class="col-sm-9">
                            <input id="edit_gClass" name="gClass" class="form-control" maxlength="10" autoComplete="off">
                        </div>
                    </div>
                    <div class="form-group" style=" height: 36px;">
                        <label for="firstname" style="height:34px; padding-top:1.2%;" class="col-sm-3 control-label">产地环境</label>
                        <div class="col-sm-9">
                            <input id="edit_gENV" name="gENV" class="form-control" maxlength="50" autoComplete="off">
                        </div>
                    </div>
                    <div class="form-group" style=" height: 36px;">
                        <label for="firstname" style="height:34px; padding-top:1.2%;" class="col-sm-3 control-label">产品销售码</label>
                        <div class="col-sm-9">
                            <input id="edit_gSellCode" name="gSellCode" class="form-control" autoComplete="off" readonly="readonly">
                        </div>
                    </div>
                    <div class="form-group" style=" height: 36px;">
                        <label for="firstname" style="height:34px; padding-top:1.2%;" class="col-sm-3 control-label">提示</label>
                        <div class="col-sm-9">
                            <input class="form-control" readonly="readonly" value="如需修改产品图片，请找到对应产品后直接点击图片进行修改！">
                        </div>
                    </div>
            </div>
            <div class="modal-footer">
                <button type="submit" class="btn btn-primary">保存</button>
                <button type="button" class="btn btn-default" data-dismiss="modal" onclick="reloadPage()">关闭</button>
            </div>
            </form>
        </div>
    </div>
</div>
<!-- /修改模态框 -->

<div class="wrapper">

    <!-- 内容区域 -->
    <!-- Content Wrapper. Contains page content -->
    <div class="content-wrapper">
        <!-- 内容头部 -->
        <section class="content-header">
            <h1>
                产品管理
                <small>Goods Tables</small>
            </h1>
            <ol class="breadcrumb">
                <li><a href="../company/home"><i class="fa fa-dashboard"></i> 首页</a></li>
                <li><a href="#">系统管理</a></li>
                <li class="active">Goods Tables</li>
            </ol>
        </section>
        <!-- 内容头部 /-->

        <!-- 正文区域 -->
        <section class="content">

            <!-- .box-body -->
            <div class="box box-primary">
                <div class="box-header with-border">
                    <h3 class="box-title">全部产品</h3>
                </div>

                <div class="box-body">
                    <!-- 数据表格 -->
                    <div class="table-box">
                        <!-- 表格工具栏 -->
                        <div id="toolbar"><div class="btn-group">
                            <button type="button" onclick="btnAdd()" class="btn btn-default" title="新建"><i class="fa fa-file-o"></i> 新建</button>
                            <button type="button" id="btn-delete" onclick="delList()" class="btn btn-default" title="删除"><i class="fa fa-trash-o"></i> 删除</button>
                        </div>
                        </div>
                        <!--数据列表-->
                        <table id="dataList" class="table table-hover table-striped table-bordered"
                               data-search-highlight="true"
                               data-show-pagination-switch="true"
                               data-show-search-button="true"
                               data-show-search-clear-button="true"
                               data-sort-name="gID"
                               data-total-field="count"
                               data-toolbar="#toolbar"
                        >
                        </table>
                        <!--数据列表/-->


                    </div>
                    <!-- 数据表格 /-->


                </div>
                <!-- /.box-body -->



            </div>

        </section>
        <!-- 正文区域 /-->
    </div>
    <!-- /.content-wrapper -->

    <!-- page script -->
    <!-- 内容区域 /-->


</div>

<!-- 引入js依赖 -->
{include file="public/introduce" /}

<script>

    var $table = $('#dataList');

    $(document).ready(function() {
        // 选择框
        $(".select2").select2();

        // WYSIHTML5编辑器
        $(".textarea").wysihtml5({
            locale: 'zh-CN'
        });
    });


    // 设置激活菜单
    function setSidebarActive(tagUri) {
        var liObj = $("#" + tagUri);
        if (liObj.length > 0) {
            liObj.parent().parent().addClass("active");
            liObj.addClass("active");
        }
    }
    // 激活导航位置
    setSidebarActive("admin-goods");

    /* 数据表格开始 */
    $(function() {
        // 列表按钮
        $("#dataList td input[type='checkbox']").iCheck({
            checkboxClass: 'icheckbox_square-blue',
            increaseArea: '20%'
        });

        //表头
        var tableColumns = [
            {
                checkbox: true
            }, {
            title: '产品编号',
            field: 'gID',
            searchable: true,
            sortable: true,
            width: 10,
            }, {
            title: '产品名称',
            field: 'gName',
            cellStyle: formatTableUnit,
            formatter: paramsMatter,
            searchable: true,
            sortable: true,
            }, {
                title: '产品图片',
                field: 'gImg',
                cellStyle: function (value, row, index) {
                    return {
                        css: {
                            "text-align": "center",
                            "height": "100%",
                            "width": "120px"
                        }
                    }
                },
                formatter : function (value, row, index) {
                    // __PUBLIC__ 会报错
                    //  __STATIC__/../ => public 文件夹
                    var img_src = "__STATIC__/../uploads/goodsImg/"+value;
                    return "<a href='#' onclick='imgClick("+index+")'><img style='width: 110px;height: 80px;' src='"+img_src+"' alt='暂无图片'></a>"
                }
            }, {
            title: '产品介绍',
            field: 'gIntroduce',
            cellStyle: formatTableUnit,
            formatter: paramsMatter,
            searchable: true,
        },
        //     {
        //     title: '产品认证',
        //     field: 'gAUT',
        //     cellStyle: formatTableUnit,
        //     formatter: paramsMatter,
        //     searchable: true,
        // },
            {
            title: '证书编号',
            field: 'gAUTCode',
            cellStyle: formatTableUnit,
            formatter: paramsMatter,
            searchable: true,
        }, {
            title: '产品类别',
            field: 'gClass',
            cellStyle: formatTableUnit,
            formatter: paramsMatter,
            searchable: true,
            sortable: true,
        }, {
            title: '产地环境',
            field: 'gENV',
            cellStyle: formatTableUnit,
            formatter: paramsMatter,
            searchable: true,
            sortable: true,
        }, {
            title: '产品销售二维码',
            field: 'gSellCodeImg',
            cellStyle: function (value, row, index) {
                return {
                    css: {
                        "text-align": "center",
                        "height": "100%",
                        "width": "100px"
                    }
                }
            },
            formatter : function (value, row, index) {
                // __PUBLIC__ 会报错
                //  __STATIC__/../ => public 文件夹
                var img_src = "__STATIC__/../uploads/"+value;
                return "<a href='#' onclick='bigImgClick("+index+")'><img style='width: 80px;height: 80px;' src='"+img_src+"' alt='暂无图片'></a>"
            },
            searchable: true,
        }, {
            title: '操作',
            width: 150,
            formatter: function (value, row, index) {
                return "<button type='button' onclick='getDetail("+index+")' class='btn btn-primary btn-xs' style='margin-left: 10%'><i class='fa fa-book'></i> 详情</button>" +
                    "<button type='button' onclick='editGoods("+index+")' class='btn btn-warning btn-xs' style='margin-left: 10%'><i class='fa fa-pencil'></i> 修改</button>"
            }
        } ];

        /** 表格赋值以及溢出隐藏 **/
        $table.bootstrapTable({

            method: 'post',
            url: "../company/getDataList", // 请求路径
            striped: true, // 是否显示行间隔色
            pageNumber: 1, // 初始化加载第一页
            pagination: true, // 是否分页
            search: true, //搜索
            showRefresh: true, //搜索处刷新
            clickToSelect: true, //是否启用点击一行任意位置选中该行
            sortOrder: "desc",     //排序方式
            sidePagination: 'client', // server:服务器端分页|client：前端分页
            pageSize: 5, // 单页记录数
            pageList: [5, 10, 15],

            queryParams: function(params) { // 上传服务器的参数
                var temp = {
                    name: $("#sname").val(),
                    viewReason: $("#viewReason").val(),
                };
                return temp;

            },

            columns: tableColumns,


        })

        //表格超出宽度鼠标悬停显示td内容
        function paramsMatter(value, row, index) {

            var span = document.createElement("span");
            span.setAttribute("title", value);
            span.innerHTML = value;

            return span.outerHTML;
        }
        //td宽度以及内容超过宽度隐藏
        function formatTableUnit(value, row, index) {
            return {
                css: {
                    "white-space": "nowrap",
                    "text-overflow": "ellipsis",
                    "overflow": "hidden",
                    "max-width": "60px"
                }
            }
        }


    });
    /* 数据表格结束 */


    /** 表格外操作 **/

    /* 点击唤起新增模态框 */
    function btnAdd(index){
        $('#addModal').modal()
    }
    /* 新增表单字段验证 */
    $('#addForm').bootstrapValidator({
        excluded: [":disabled", ":hidden", ":not(:visible)"], //不验证的情况
        message: '表单校验',
        /**
         * 生效规则（三选一）
         * enabled 字段值有变化就触发验证
         * disabled,submitted 当点击提交时验证并展示错误信息
         */
        live: 'enabled',
        //验证字段以及规则
        fields: {

            gName: {
                message: "gName字段校验",
                trigger: "change",
                validators: {
                    notEmpty: {
                        message: '产品名称不能为空'
                    }
                },
            },
            gClass: {
                message: "gClass字段校验",
                trigger: "change",
                validators: {
                    notEmpty: {
                        message: '产品类别不能为空'
                    },
                    regexp: {
                        regexp:/^[\u4e00-\u9fa5]+$/,
                        message: '只能输入汉字'
                    },
                }
            },

        },
    }).on("success.form.bv",function (e){ //验证成功后提交表单
        var files = $('#add_gImg').prop('files');
        var formData = new FormData();

        //把表单中的字段值都加进去
        formData.append('gName',$('#add_gName').val());
        formData.append('gIntroduce',$('#add_gIntroduce').val());
        formData.append('gAUTCode',$('#add_gAUTCode').val());
        formData.append('gClass',$('#add_gClass').val());
        formData.append('gENV',$('#add_gENV').val());
        formData.append('gImg',files[0]);

        $.ajax({
            url: "../company/addGoods",
            type: "post",
            async: false,
            data: formData,
            cache: false, // 上传文件无需缓存
            processData : false, // 使数据不做处理
            contentType : false, // 不要设置Content-Type请求头
            success: function(data){
                if (data.success == 'true') {
                    alert('新增成功！');
                }
            },
            error:function(response){
                console.log(response);
            }
        });
    });

    /* 选中后点击删除按钮 */
    function delList(){
        if (!confirm("是否确认删除？"))
            return;
        var rows = $table.bootstrapTable('getSelections');// 获得要删除的数据
        if(rows.length == 0){
            alert("请选择需要删除的数据");
            return;
        }else{
            var ids = new Array();  // 声明一个数组
            $(rows).each(function() {  // 遍历选中行
                ids.push(this.gID);  // gID为获得到的整条数据中的一列，将其放入数组中
            });
            deleteMs(ids); //调用删除操作函数
        }
    }
    /* 进行删除操作的函数 */
    function deleteMs(ids){
        $.ajax({
            url: "../company/doDelete",
            type: "post",
            data: "ids="+ids,
            dataType: "json",
            async: false,
            success: function(result) { //刷新表格
                $table.bootstrapTable('refresh', {
                    url : '../company/getDataList'
                });
            }
        })
    }

    /** 表格外操作完 **/

    /** 行内操作 **/

    /* 点击图片唤起点击图片模态框 */
    function imgClick(index){
        var row = $table.bootstrapTable('getData')[index];
        $('#img_gID').val(row.gID);
        $('#imgModal').modal();
    }
    /* 点击按钮进行更新图片操作 */
    function btnImg(){

        var files = $('#img_file').prop('files');
        var gID = $('#img_gID').val();
        if(files.length <= 0){
            alert("请选择文件");
            return;
        }
        var formData = new FormData();
        formData.append("gImg",files[0]);
        formData.append("gID",gID);

        $.ajax({
            url: "../company/goodsImg",
            type: "post",
            data: formData,
            async: false,
            cache: false, // 上传文件无需缓存
            processData : false, // 使数据不做处理
            contentType : false, // 不要设置Content-Type请求头
            success: function(data){
                if (data.success == 'true') {
                    alert('上传成功！');
                }
            },
            error:function(response){
                console.log(response);
            }
        })
    }

    /* 点击图片唤起大图模态框 */
    function bigImgClick(index){
        var row = $table.bootstrapTable('getData')[index];
        // console.log(row);
        $('#bigImg').attr('src',"__STATIC__/../uploads/"+row.gSellCodeImg);
        $('#bigImgModal').modal();
    }

    /* 查看指定行详情 */
    function getDetail(index){
        //通过当前行在表中的index 获取当前行信息
        var row = $table.bootstrapTable('getData')[index]; //getData方法获取表中信息
        //console.log(row)
        //填充行中对应数据到模态框中
        $("#detail_gImg").attr('src', "__STATIC__/../uploads/goodsImg/"+row.gImg);
        $("#detail_gID").val(row.gID);
        $("#detail_gName").val(row.gName);
        $("#detail_gIntroduce").val(row.gIntroduce);
        $("#detail_gAUTCode").val(row.gAUTCode);
        $("#detail_gClass").val(row.gClass);
        $("#detail_gENV").val(row.gENV);
        $("#detail_gSellCode").val(row.gSellCode);
        //唤起modal
        $("#detailModal").modal();
    }

    /* 点击编辑数据按钮 */
    function editGoods(index){
        // alert(index)
        //通过当前行在表中的index 获取当前行信息
        var row = $table.bootstrapTable('getData')[index];
        //console.log(row)
        //填充行中对应数据到模态框中
        $("#edit_gID").val(row.gID);
        $("#edit_gID_hidden").val(row.gID);
        $("#edit_gName").val(row.gName);
        $("#edit_gIntroduce").val(row.gIntroduce);
        $("#edit_gAUTCode").val(row.gAUTCode);
        $("#edit_gClass").val(row.gClass);
        $("#edit_gENV").val(row.gENV);
        $("#edit_gSellCode").val(row.gSellCode);
        //唤起modal
        $("#editModal").modal();
    }

    /* 更改表单字段验证 */
    $('#editForm').bootstrapValidator({
        excluded: [":disabled", ":hidden", ":not(:visible)"], //不验证的情况
        message: '表单校验',
        /**
         * 生效规则（三选一）
         * enabled 字段值有变化就触发验证
         * disabled,submitted 当点击提交时验证并展示错误信息
         */
        live: 'enabled',
        //验证字段以及规则
        fields: {

            gName: {
                message: "gName字段校验",
                trigger: "change",
                validators: {
                    notEmpty: {
                        message: '产品名称不能为空'
                    }
                }
            },
            gClass: {
                message: "gClass字段校验",
                trigger: "change",
                validators: {
                    notEmpty: {
                        message: '产品类别不能为空'
                    },
                    regexp: {
                        regexp:/^[\u4e00-\u9fa5]+$/,
                        message: '只能输入汉字'
                    },
                }
            },

        },
    }).on("success.form.bv",function (e){ //验证成功后提交表单
        $.ajax({
            url: "../company/editGoods",
            type: "post",
            async: false,
            data: $('#editForm').serialize()
        });
    });


    /** 行内操作完 **/


    /* 刷新页面 */
    function reloadPage(){
        location.reload();
    }


</script>
</body>

</html>
<!---->

{/block}